﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Login;

namespace UI 
{
    public class LoginNormalUI : MonoBehaviour
    {
        public LoginUI loginUI;

        public GameObject loginBtn;
        public GameObject loginYingyongbaoBtn;
        public GameObject switchAccountBtn;
        public GameObject versionLabel;

        public GameObject internalAccountPanel;

        public UISprite loginTextSprite;

        void Start()
        {

            if (GameConfig.Instance.platform == 2 && GameConfig.Instance.GetChannelId == ChannelId.YingYongBao)
            {
                loginYingyongbaoBtn.SetActive(true);
                loginBtn.SetActive(false);
            }
            else
            {
                loginBtn.SetActive(true);
            }
            //乐视渠道显示切换账号
            
            if (GameConfig.Instance.platform == 1)
            {
                switchAccountBtn.SetActive(true);
            }
            else
            {
                string channelID = PlatformSDK.GetInstance().SuperSDKChannelId();
                switchAccountBtn.SetActive(channelID.Equals(ChannelId.LeTV));
            }
            SetVersion(GameConfig.Instance.AppVersion);
            loginTextSprite.spriteName = "UI_denglu_word_jinruyouxi";
            loginTextSprite.MakePixelPerfect();
        }



        public void Show(bool isShow = false)
        {
            gameObject.SetActive(true);
            if (isShow)
            {
                loginYingyongbaoBtn.SetActive(false);
            }
            loginBtn.SetActive(true);
            SetVersion(GameConfig.Instance.AppVersion);
        }

        public void Hide()
        {
            gameObject.SetActive(false);
        }

        public void SetVersion(string version)
        {
            versionLabel.GetComponent<UILabel>().text = LanguageTool.GetTextNoUpdate(1054) + version + "(" + GameConfig.Instance.ResVersion + ")";
        }

        public void ShowInternalAccountPanel()
        {
            internalAccountPanel.GetComponent<UserInput>().Show();
        }

        public void HideInternalAccoutnPanel()
        {
            internalAccountPanel.GetComponent<UserInput>().Hide();
        }


    }
}